home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
NeXTSTEP 3.1 (Developer) [x86]
/
NeXT Step 3.1 Intel dev.cdr.dmg
/
NextDeveloper
/
Examples
/
SoundAndMusic
/
SoundLibrary
/
playtest.c
< prev
next >
Wrap
Text File
|
1990-10-10
|
986b
|
45 lines
/*
* playtest - this example plays all the soundfiles specified in the
* command line, without any gap between them. If the soundfiles are all
* of the same type, no samples are lost.
*/
#import <sound/sound.h>
#import <stdio.h>
main (int argc, char *argv[])
{
int size, err, i;
SNDSoundStruct *s;
if (argc < 2) {
fprintf(stderr,"usage : playtest file ...\n");
exit(1);
}
//
// read each soundfile and queue it up for playing. The termination
// function will free the sound
//
for (i=1; i<argc; i++) {
err = SNDReadSoundfile(argv[i],&s);
if (err)
fprintf(stderr,"playtest : Cannot read soundfile : %s\n",argv[i]);
else {
err = SNDStartPlaying(s,i,5,0,0,(SNDNotificationFun)SNDFree);
if (err)
fprintf(stderr,"playtest : Cannot play soundfile : %s\n",
argv[i]);
}
}
//
// wait for the sounds to finish
// Note that a tag of 0 means 'wait for all'
//
SNDWait(0);
exit(0);
}